let path = `/user/:user_id`;
let url = `/user/100`;
let {pathToRegexp} = require('path-to-regexp');
//pathToRegexp可以把路径字符串(包括路径参数)转成一个匹配该路径的正则表达式
const regexp = pathToRegexp(path);
console.log(regexp)
// /^\/user(?:\/([^\/#\?]+?))[\/#\?]?$/i
//   \/user(?:\/([^\/#\?]+?)) [\/#\?]?
const result = url.match(regexp);
console.log(result)